/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.blitzcoder.collide.engine.parser;

/**
 *
 * @author blitzcoder
 */
public class CodeVariable extends CodeObject {
    private String value;
    private String type;
    
    public CodeVariable(String name,int line,String type,String value) {
        super(name,line);
        this.type = type;
        this.value = value;
    }
    
    public CodeVariable(String name,int line,String type) {
        this(name,line,type,"");
    }
    
    public String getType() {
        return type;
    }
    
    public String getValue() {
        return value;
    }
    
    @Override
    public String toString() {
        return super.toString()+":"+getType();
    }

    @Override
    public String getObjectType() {
        return "Variable";
    }

    public boolean equals(Object o) {
        if (o instanceof CodeVariable) {
            CodeVariable v = (CodeVariable) o;
            return v.getName().equals(getName()) && v.getType().equals(type) && v.getValue().equals(value);
        }
        return false;
    }
    
}
